package com.atguigu.springboothellword2.controller;

import com.atguigu.springboothellword2.bean.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Controller
public class PersonController {
    @Autowired
    private Person person;

    @GetMapping("/getView")
    public String helloView(Model model){

        model.addAttribute("msg","你好 guigu");
        model.addAttribute("link","http://www.baidu.com");

        return "success";
    }

    @RequestMapping("/person")
    public Person getPerson(){
        return person;
    }
}
